import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/views/Login'
import Main from '@/views/Main'
import Home from '@/views/Home'
Vue.use(Router)

export default new Router({
	routes: [{
		path: '/login',
		name: 'Login',
		component: Login
	}, {
		path: '/',
		name: '管理后台',
		component: Main,
		redirect: {
			path: 'home'
		},
		children: [{
				path: '/home',
				name: '首页',
				component: Home
			},
			{
				name: '商户列表',
				path: '/userList',
				component: resolve => require(['../views/user/userList.vue'], resolve),
			},
			{
				name: '商户白名单',
				path: '/userWhiteList',
				component: resolve => require(['../views/user/userWhiteList.vue'], resolve),
			},
			{
				name: '商户密钥',
				path: '/userKeys',
				component: resolve => require(['../views/user/userKeys.vue'], resolve),
			},
			{
				name: '商户订单',
				path: '/MerchantOrders',
				component: resolve => require(['../views/merchant/MerchantOrders.vue'], resolve),
			},
			{
				name: '商户资产',
				path: '/MerchantAssets',
				component: resolve => require(['../views/merchant/MerchantAssets.vue'], resolve),
			},
			{
				name: '商户流水',
				path: '/MerchantFlow',
				component: resolve => require(['../views/merchant/MerchantFlow.vue'], resolve),
			},
			{
				name: '资产申请',
				path: '/MerchantApply',
				component: resolve => require(['../views/merchant/MerchantApply.vue'], resolve),
			},
			{
				name: '404',
				path: '/404',
				component: resolve => require(['../views/404.vue'], resolve),
			}
		]
	}, {
		path: '*',
		redirect: {
			path: '/404'
		}
	}]
})